import request from '@/router/axios';
import {downloadExcel} from '@/router/axios';
import {formatCondition} from '@/util/util';
//单条查询
export const queryMessageConfigInfo = (params) => {
  params.head.transCode = 'queryMessageConfigInfo';
  return request({
    url: '/platform/messageConfigInfo/queryMessageConfigInfo',
    method: 'post',
    data: params
  })
}
//多条列表查询，支持条件查询
export const queryMessageConfigInfoListPage = (params) => {
  params.head.transCode = 'queryMessageConfigInfoListPage';
  return request({
    url: '/platform/messageConfigInfo/queryMessageConfigInfoListPage',
    method: 'post',
    data: params
  })
}
//新增单条记录
export const saveMessageConfigInfo = (params) => {
  params.head.transCode = 'saveMessageConfigInfo';
  return request({
    url: '/platform/messageConfigInfo/saveMessageConfigInfo',
    method: 'post',
    data: params
  })
}
//新增多条记录
export const saveMessageConfigInfoList = (params) => {
  params.head.transCode = 'saveMessageConfigInfoList';
  return request({
    url: '/platform/messageConfigInfo/saveMessageConfigInfoList',
    method: 'post',
    data: params
  })
}
//新增或修改单条记录
export const saveOrUpdateMessageConfigInfo = (params) => {
  params.head.transCode = 'saveOrUpdateMessageConfigInfo';
  return request({
    url: '/platform/messageConfigInfo/saveOrUpdateMessageConfigInfo',
    method: 'post',
    data: params
  })
}


//新增或修改单条记录
export const saveOrUpdateMessageConfigInfoList = (params) => {
  params.head.transCode = 'saveOrUpdateMessageConfigInfoList';
  return request({
    url: '/platform/messageConfigInfo/saveOrUpdateMessageConfigInfoList',
    method: 'post',
    data: params
  })
}

//修改单条记录
export const updateMessageConfigInfo = (params) => {
  params.head.transCode = 'updateMessageConfigInfo';
  return request({
    url: '/platform/messageConfigInfo/updateMessageConfigInfo',
    method: 'post',
    data: params
  })
}

//删除单条记录
export const deleteMessageConfigInfo = (params) => {
  params.head.transCode = 'deleteMessageConfigInfo';
  return request({
    url: '/platform/messageConfigInfo/deleteMessageConfigInfo',
    method: 'post',
    data: params
  })
}

//删除多条记录
export const deleteMessageConfigInfoList = (params) => {
  params.head.transCode = 'deleteMessageConfigInfoList';
  return request({
    url: '/platform/messageConfigInfo/deleteMessageConfigInfoList',
    method: 'post',
    data: params
  })
}
//导出excel
export const exportMessageConfigInfoExcel = (params) => {
  downloadExcel({
    url: '/platform/messageConfigInfo/excelDownload/exportMessageConfigInfoExcel',
    method: 'get',
    data: 
    {
      tenantId: params.head.tenantId,
      orders:'',
      condition: formatCondition(params.body.sqlCondition)
    }
  })
}

//查询发送场景和消息类型
export const querySceneAndType = (params) => {
  params.head.transCode = 'querySceneAndType';
  return request({
    url: '/platform/messageConfigInfo/querySceneAndType',
    method: 'post',
    data: params
  })
}
